<template>
    <view
        :class="['container', 'data-v-74224a21', isDarkMode ? 'dark-bg' : '']"
        :style="'background-size: 100% auto; height: 100vh; background-image: url(+bgImage+); background-size: 100% auto; background-position: center center;'"
    >
        <text-nav-bar @__l="__l" class="data-v-74224a21" :darkMode="isDarkMode" :title="info.title" vueId="f48898a0-1"></text-nav-bar>
        <image
            @tap="__e"
            :class="['bgm-icon', 'data-v-74224a21', !isBgmPlay ? 'disable' : '']"
            :data-event-opts="[['tap', [['$switchBgm', ['$event']]]]]"
            mode="widthFix"
            src="https://cdn2.hquesoft.com/box/music-icon.png"
            v-if="config.bgm"
        ></image>
        <navigator class="data-v-74224a21" url="/pages/rule/index?type=box">
            <view class="float-btn rule data-v-74224a21" hoverClass="hover">
                <image class="data-v-74224a21" mode="aspectFill" src="/static/static/smallBox/rule.png"></image>
                <text class="data-v-74224a21">规则</text>
            </view>
        </navigator>
        <navigator class="data-v-74224a21" url="/pages/myBox/index">
            <view class="float-btn my data-v-74224a21" hoverClass="hover">
                <image class="data-v-74224a21" mode="aspectFill" src="/static/static/smallBox/my-box.png"></image>
                <text class="data-v-74224a21">盒柜</text>
            </view>
        </navigator>
        <view @tap="__e" class="float-btn share data-v-74224a21" :data-event-opts="[['tap', [['e0', ['$event']]]]]" hoverClass="hover">
            <text class="new-iconfont icon-wechat data-v-74224a21"></text>
            <text class="data-v-74224a21">分享</text>
        </view>
        <view @tap="__e" class="float-btn rand-list data-v-74224a21" :data-event-opts="[['tap', [['e1', ['$event']]]]]" hoverClass="hover" v-if="info.is_hidden_sku_rank">
            <text class="data-v-74224a21">榜单</text>
        </view>
        <view :class="['content', 'data-v-74224a21', deepColor ? 'deep' : '']" v-if="isInit">
            <box-thmem-default
                @__l="__l($event, { eventOpts: [['^select', [['handleSelect']]]] })"
                @select="__e($event, { eventOpts: [['^select', [['handleSelect']]]] })"
                :class="['animated', 'data-v-74224a21', startMoving ? 'bounceOutRight' : '', !startMoving ? 'bounceInLeft' : '']"
                :data-event-opts="[['^select', [['handleSelect']]]]"
                :info="info"
                :room="room"
                vueId="f48898a0-2"
                v-if="viewType == 'default'"
            ></box-thmem-default>
            <block v-else>
                <box-theme3-d
                    @__l="__l($event, { eventOpts: [['^select', [['handleSelect']]]] })"
                    @select="__e($event, { eventOpts: [['^select', [['handleSelect']]]] })"
                    :class="['animated', 'data-v-74224a21', startMoving ? 'bounceOutRight' : '', !startMoving ? 'bounceInLeft' : '']"
                    :data-event-opts="[['^select', [['handleSelect']]]]"
                    :info="info"
                    :room="room"
                    vueId="f48898a0-3"
                    v-if="viewType == '3d'"
                ></box-theme3-d>
            </block>
            <view class="gift-box-number data-v-74224a21">
                <text class="data-v-74224a21">{{ 'NO.' + room.number }}</text>
                <view class="tips data-v-74224a21">{{ tips }}</view>
            </view>
            <view @tap="__e" class="lottery-tips data-v-74224a21" :data-event-opts="[['tap', [['goJikaDetail', ['$event']]]]]" v-if="info.jika">
                <text class="data-v-74224a21">每抽一盒赠送一次集卡机会</text>
                <text class="new-iconfont icon-arrow-right data-v-74224a21"></text>
            </view>
            <block v-else>
                <view @tap="__e" class="lottery-tips data-v-74224a21" :data-event-opts="[['tap', [['goLotteryDetail', ['$event']]]]]" v-if="info.lottery">
                    <text class="data-v-74224a21">每抽一盒赠送一张活动抽奖码</text>
                    <text class="new-iconfont icon-arrow-right data-v-74224a21"></text>
                </view>
            </block>
            <view class="card-list data-v-74224a21">
                <view @tap="__e" class="item data-v-74224a21" :data-event-opts="[['tap', [['buyWholeRoom', ['$event']]]]]" hoverClass="hover" v-if="info.sku_ratio_type === 1">
                    <text class="data-v-74224a21">整盒端</text>
                </view>
                <view @tap="__e" class="item data-v-74224a21" :data-event-opts="[['tap', [['buyMany', [5]]]]]" hoverClass="hover" v-else>
                    <text class="data-v-74224a21">连抽5个</text>
                </view>
            </view>
            <block v-if="info.is_presell">
                <view class="presell-mask data-v-74224a21" v-if="info.presell_mode === 0">
                    <view class="data-v-74224a21">此款为预售款，开售后可购买</view>
                    <view class="data-v-74224a21">
                        <count-down
                            @__l="__l"
                            class="text data-v-74224a21"
                            :end="info.presell_date"
                            endText="当前已开售"
                            :start="info.presell_date"
                            vueId="f48898a0-4"
                        ></count-down>
                    </view>
                </view>
                <block v-else>
                    <view class="presell-mask data-v-74224a21" v-if="info.presell_mode === 1">
                        <view class="data-v-74224a21">{{ '此款为预售款，' + $root.g0 + '后开始发货' }}</view>
                    </view>
                </block>
            </block>
            <view :class="['btn-g', 'data-v-74224a21', !isThemeChangeable ? 'btn-2' : '']">
                <view @tap="__e" class="button data-v-74224a21" :data-event-opts="[['tap', [['exchangeNumber', ['$event']]]]]">
                    <view class="button-c data-v-74224a21" hoverClass="hover">
                        <image class="data-v-74224a21" mode="aspectFit" src="/static/bigBox/change.png"></image>
                    </view>
                    <text class="data-v-74224a21">换一盒</text>
                </view>
                <view @tap="__e" class="button data-v-74224a21" :data-event-opts="[['tap', [['showImages', ['$event']]]]]">
                    <view class="button-c data-v-74224a21" hoverClass="hover">
                        <image class="data-v-74224a21" mode="aspectFit" src="/static/bigBox/product.png"></image>
                    </view>
                    <text class="data-v-74224a21">查看商品</text>
                </view>
                <view @tap="__e" class="button data-v-74224a21" :data-event-opts="[['tap', [['changeView', ['$event']]]]]" v-if="isThemeChangeable">
                    <view class="button-c data-v-74224a21" hoverClass="hover">
                        <image class="data-v-74224a21" mode="aspectFit" src="/static/bigBox/flash.png"></image>
                    </view>
                    <text class="data-v-74224a21" v-if="viewType === 'default'">3D视角</text>
                    <block v-else>
                        <text class="data-v-74224a21" v-if="viewType === '3d'">扁平风</text>
                    </block>
                </view>
            </view>
        </view>
        <view class="data-v-74224a21" style="height: 100rpx"></view>
        <uni-popup
            @__l="__l($event, { ref: 'detailPopup' })"
            class="data-v-74224a21 vue-ref"
            data-ref="detailPopup"
            style="z-index: 1000"
            type="bottom"
            vueId="f48898a0-5"
            :vueSlots="['default']"
        >
            <box-sku-popup
                @__l="__l($event, { eventOpts: [['^close', [['e2']]]] })"
                @close="__e($event, { eventOpts: [['^close', [['e2']]]] })"
                class="data-v-74224a21"
                :data-event-opts="[['^close', [['e2']]]]"
                :detailImageList="info.detail_images"
                :setting="skuListSetting"
                :skuList="skuList"
                :vueId="'f48898a0-6' + ',' + 'f48898a0-5'"
            ></box-sku-popup>
        </uni-popup>
        <share-popup
            @__l="__l($event, { eventOpts: [['^close', [['e3']]]] })"
            @close="__e($event, { eventOpts: [['^close', [['e3']]]] })"
            class="data-v-74224a21"
            :data-event-opts="[['^close', [['e3']]]]"
            :info="posterInfo"
            vueId="f48898a0-7"
            v-if="isSharePopup"
        ></share-popup>
        <hidden-sku-rank
            @__l="__l($event, { eventOpts: [['^close', [['e4']]]] })"
            @close="__e($event, { eventOpts: [['^close', [['e4']]]] })"
            class="data-v-74224a21"
            :data-event-opts="[['^close', [['e4']]]]"
            :info="info"
            vueId="f48898a0-8"
            v-if="uuid && isShowHiddenSkuRank"
        ></hidden-sku-rank>
        <danmus @__l="__l" class="data-v-74224a21" :list="danmuList" :setting="danmuSetting" :uuid="uuid" vueId="f48898a0-9" v-if="danmuSetting.is_enabled"></danmus>
    </view>
</template>

<script>
import textNavBar from '@/components/TextNavBar/TextNavBar';
import countDown from '@/components/CountDown/CountDown';
import uniPopup from '@/uni_modules/uni-popup/components/uni-popup/uni-popup';
import boxSkuPopup from '@/components/BoxSkuPopup/BoxSkuPopup';
import sharePopup from '@/components/SharePopup/SharePopup';
import hiddenSkuRank from '@/components/HiddenSkuRank/HiddenSkuRank';
import danmus from '@/components/Danmus/Danmus';
import boxThmemDefault from '@/pages/boxDetail/boxTheme/Default';
import boxTheme3D from '@/pages/boxDetail/boxTheme/Box3D';
import tabBar from '@/components/TabBar/tabBar';
(global.webpackJsonp = global.webpackJsonp || []).push([
    ['pages/boxDetail/index'],
    {
        '141a': function (t, n, e) {
            'use strict';

            e.r(n);
            var i = e('8c36');
            var o = e.n(i);
            for (var u in i) {
                if (['default'].indexOf(u) < 0) {
                    (function (t) {
                        e.d(n, t, function () {
                            return i[t];
                        });
                    })(u);
                }
            }
            n.default = o.a;
        },
        '1c44': function (t, n, e) {
            'use strict';

            var i = e('662f');
            e.n(i).a;
        },
        '23f0': function (t, n, e) {
            'use strict';

            e.d(n, 'b', function () {
                return o;
            });
            e.d(n, 'c', function () {
                return u;
            });
            e.d(n, 'a', function () {
                return i;
            });
            var i = {
                TextNavBar: function () {
                    return e.e('components/TextNavBar/TextNavBar').then(e.bind(null, '9141'));
                },
                CountDown: function () {
                    return e.e('components/CountDown/CountDown').then(e.bind(null, '2fed'));
                },
                uniPopup: function () {
                    return e.e('uni_modules/uni-popup/components/uni-popup/uni-popup').then(e.bind(null, '0fa2'));
                },
                BoxSkuPopup: function () {
                    return e.e('components/BoxSkuPopup/BoxSkuPopup').then(e.bind(null, 'f1cb'));
                },
                SharePopup: function () {
                    return Promise.all([e.e('common/vendor'), e.e('components/SharePopup/SharePopup')]).then(e.bind(null, 'b677'));
                },
                HiddenSkuRank: function () {
                    return e.e('components/HiddenSkuRank/HiddenSkuRank').then(e.bind(null, '0818'));
                },
                Danmus: function () {
                    return e.e('components/Danmus/Danmus').then(e.bind(null, '4bc1'));
                }
            };
            var o = function () {
                var that = this;
                var n =
                    (that.$createElement,
                    that._self._c,
                    that.isInit && that.info.is_presell && 0 !== that.info.presell_mode && 1 === that.info.presell_mode
                        ? that.$tool.formatDate(that.info.presell_date, 'yyyy-MM-dd')
                        : null);
                that._isMounted ||
                    ((that.e0 = function (n) {
                        that.isSharePopup = true;
                    }),
                    (that.e1 = function (n) {
                        that.isShowHiddenSkuRank = true;
                    }),
                    (that.e2 = function (n) {
                        return that.$refs.detailPopup.close();
                    }),
                    (that.e3 = function (n) {
                        that.isSharePopup = false;
                    }),
                    (that.e4 = function (n) {
                        that.isShowHiddenSkuRank = false;
                    }));
                that.$mp.data = Object.assign(
                    {},
                    {
                        $root: {
                            g0: n
                        }
                    }
                );
            };
            var u = [];
        },
        '25ed': function (t, n, e) {
            'use strict';

            e.r(n);
            var i = e('23f0');
            var o = e('141a');
            for (var u in o) {
                if (['default'].indexOf(u) < 0) {
                    (function (t) {
                        e.d(n, t, function () {
                            return o[t];
                        });
                    })(u);
                }
            }
            e('1c44');
            var r = e('f0c5');
            var a = Object(r.a)(o.default, i.b, i.c, false, null, '74224a21', null, false, i.a, void 0);
            n.default = a.exports;
        },
        '662f': function (t, n, e) {},
        '7f10': function (t, n, e) {
            'use strict';

            (function (t, n) {
                var i = e('4ea4');
                e('18ba');
                i(e('66fd'));
                var o = i(e('25ed'));
                t.__webpack_require_UNI_MP_PLUGIN__ = e;
                n(o.default);
            }.call(this, e('bc2e').default, e('543d').createPage));
        },
        '8c36': function (t, n, e) {
            'use strict';

            (function (t) {
                var i = e('4ea4');
                Object.defineProperty(n, '__esModule', {
                    value: true
                });
                n.default = void 0;
                var o = i(e('2eee'));
                var u = i(e('c973'));
                var r = i(e('9523'));
                function a(t, n) {
                    var e = Object.keys(t);
                    if (Object.getOwnPropertySymbols) {
                        var i = Object.getOwnPropertySymbols(t);
                        if (n) {
                            i = i.filter(function (n) {
                                return Object.getOwnPropertyDescriptor(t, n).enumerable;
                            });
                        }
                        e.push.apply(e, i);
                    }
                    return e;
                }
                function s(t) {
                    for (var n = 1; n < arguments.length; n++) {
                        if (null != arguments[n]) {
                            var e = arguments[n];
                        } else {
                            var e = {};
                        }
                        n % 2
                            ? a(Object(e), true).forEach(function (n) {
                                  (0, r.default)(t, n, e[n]);
                              })
                            : Object.getOwnPropertyDescriptors
                            ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(e))
                            : a(Object(e)).forEach(function (n) {
                                  Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(e, n));
                              });
                    }
                    return t;
                }
                var c = {
                    components: {
                        BoxThmemDefault: function () {
                            e.e('pages/boxDetail/boxTheme/Default')
                                .then(
                                    function () {
                                        return resolve(e('c265'));
                                    }.bind(null, e)
                                )
                                .catch(e.oe);
                        },
                        BoxTheme3D: function () {
                            e.e('pages/boxDetail/boxTheme/Box3D')
                                .then(
                                    function () {
                                        return resolve(e('798f'));
                                    }.bind(null, e)
                                )
                                .catch(e.oe);
                        }
                    },
                    data: function () {
                        return {
                            loading: true,
                            test: false,
                            uuid: '',
                            info: {},
                            number: 12,
                            contentHeight: 4000,
                            deepColor: false,
                            startMoving: false,
                            userlist: [],
                            deviceHeight: this.$device.screenHeight,
                            viewType: '3d',
                            isSharePopup: false,
                            isShowHiddenSkuRank: false,
                            isShowDetail: false,
                            isInit: false,
                            danmuList: [],
                            danmuSetting: {},
                            skuList: [],
                            skuListSetting: {}
                        };
                    },
                    computed: s(
                        s({}, (0, e('26cb').mapGetters)(['userInfo', 'token'])),
                        {},
                        {
                            config: function () {
                                return this.$store.getters.setting.box_room || {};
                            },
                            contentStyle: function () {
                                return 'min-height:'.concat(this.contentHeight, 'px;background-color: ').concat(this.info.bg_color, ';');
                            },
                            room: function () {
                                return this.info.room || {};
                            },
                            avatar: function () {
                                return this.token ? this.userInfo.headimg : '/static/toux.png';
                            },
                            share: function () {
                                return {
                                    title: this.info.title,
                                    thumb: this.info.thumb,
                                    desc: '',
                                    path: '/pages/boxDetail/index?uuid=' + this.info.uuid + '&invite_node=box-' + this.info.uuid
                                };
                            },
                            posterInfo: function () {
                                var t = this.getShareConfig(false);
                                return {
                                    money_price: this.info.money_price,
                                    score_price: this.info.score_price,
                                    title: this.info.title,
                                    path: t.path,
                                    app_url: t.app_url,
                                    thumb: this.info.thumb
                                };
                            },
                            bgImage: function () {
                                return this.isInit ? this.info.room_bg_image || this.config.bg_image || 'https://cdn2.hquesoft.com/box/bg.png' : '';
                            },
                            isDarkMode: function () {
                                return 2 === this.info.bg_color_mode;
                            },
                            tips: function () {
                                return this.info.tips || '官方正品，非质量问题不支持退换';
                            },
                            isThemeChangeable: function () {
                                return 1 === this.info.theme_mode || 2 === this.info.theme_mode;
                            }
                        }
                    ),
                    onLoad: function (n) {
                        var that = this;
                        this.test = !!n.test;
                        this.uuid = n.uuid;
                        t.getSystemInfo({
                            success: function (t) {
                                that.contentHeight = t.windowHeight;
                            }
                        });
                        t.showLoading({
                            title: '加载中',
                            mask: true
                        });
                        this.$http('/boxes/' + n.uuid)
                            .then(function (n) {
                                that.isInit = true;
                                that.loading = false;
                                t.hideLoading();
                                var i = n.data.info;
                                that.info = i;
                                t.setNavigationBarTitle({
                                    title: that.info.title
                                });
                                (2 !== that.info.theme_mode && 4 !== that.info.theme_mode) || (that.viewType = 'default');
                                that.$visitor.record({
                                    type: 'box_detail',
                                    title: that.info.title
                                });
                                that.$http('/boxes/'.concat(that.uuid, '/skus')).then(function (t) {
                                    that.skuList = t.data.list;
                                });
                                that.getDanmu();
                            })
                            .catch(function (n) {
                                t.hideLoading();
                            });
                        if (this.config.bgm) {
                            this.$playBgm(this.config.bgm);
                        }
                    },
                    watch: {
                        config: function () {
                            if (this.config.bgm) {
                                this.$playBgm(this.config.bgm);
                            }
                        }
                    },
                    onUnload: function () {
                        this.$stopBgm();
                    },
                    onShow: function () {
                        var that = this;
                        if (this.info.uuid) {
                            this.$http('/boxes/' + this.info.uuid, 'GET', {
                                room_id: this.room.id
                            }).then(function (n) {
                                var e = n.data.info;
                                that.info = e;
                            });
                        }
                        this.$http('/setting/box').then(function (n) {
                            that.skuListSetting = n.data.setting;
                        });
                    },
                    methods: {
                        goLotteryDetail: function () {
                            t.navigateTo({
                                url: '/pages/lottery/detail?uuid=' + this.info.lottery.uuid
                            });
                        },
                        goJikaDetail: function () {
                            t.navigateTo({
                                url: '/pages/jika/detail?uuid=' + this.info.jika.uuid
                            });
                        },
                        buyMany: function (n) {
                            if (this.info.is_presell && 0 === this.info.presell_mode) {
                                t.showToast({
                                    title: '此款正在预售中，暂不可购买哦~',
                                    icon: 'none'
                                });
                                return false;
                            }
                            var e = this.room.sku_status.findIndex(function (t) {
                                return 0 === t;
                            });
                            if (-1 == e) {
                                t.showToast({
                                    title: '此盒已售完，换一盒吧~',
                                    icon: 'none'
                                });
                                return false;
                            }
                            t.navigateTo({
                                url: '/pages/openBox/index?index='
                                    .concat(e + 1, '&roomUuid=')
                                    .concat(this.room.uuid, '&uuid=')
                                    .concat(this.info.uuid, '&buyMode=')
                                    .concat(n)
                            });
                        },
                        buyWholeRoom: function () {
                            var that = this;
                            if (this.info.is_presell && 0 === this.info.presell_mode) {
                                t.showToast({
                                    title: '此款正在预售中，暂不可购买哦~',
                                    icon: 'none'
                                });
                                return false;
                            }
                            this.$http('/user').then(function (e) {
                                t.navigateTo({
                                    url: '/pages/openBox/index?index='.concat(2, '&roomUuid=').concat(that.room.uuid, '&uuid=').concat(that.info.uuid, '&buyMode=wholeRoom')
                                });
                            });
                        },
                        getDanmu: function () {
                            var that = this;
                            this.$http('/danmus/box_detail?node_id='.concat(this.info.id)).then(function (n) {
                                that.danmuSetting = n.data.setting;
                                that.danmuList = n.data.list;
                            });
                        },
                        changeView: function () {
                            'default' == this.viewType ? (this.viewType = '3d') : '3d' == this.viewType && (this.viewType = 'default');
                        },
                        refresh: function (n) {
                            var that = this;
                            return (0, u.default)(
                                o.default.mark(function n() {
                                    var i;
                                    return o.default.wrap(function (n) {
                                        for (;;) {
                                            switch ((n.prev = n.next)) {
                                                case 0:
                                                    t.showLoading({});
                                                    n.next = 3;
                                                    return getBoxInfo(that.info.uuid);
                                                case 3:
                                                    i = n.sent;
                                                    that.info = i.data.info;
                                                    t.hideLoading();
                                                case 6:
                                                case 'end':
                                                    return n.stop();
                                            }
                                        }
                                    }, n);
                                })
                            )();
                        },
                        handleSelect: function (n) {
                            this.test
                                ? t.navigateTo({
                                      url: '/pages/testOpenBox/index?index='
                                          .concat(n + 1, '&roomUuid=')
                                          .concat(this.room.uuid, '&uuid=')
                                          .concat(this.info.uuid)
                                  })
                                : t.navigateTo({
                                      url: '/pages/openBox/index?index='
                                          .concat(n + 1, '&roomUuid=')
                                          .concat(this.room.uuid, '&uuid=')
                                          .concat(this.info.uuid)
                                  });
                        },
                        hideImages: function () {
                            this.visible = false;
                        },
                        showImages: function () {
                            this.$refs.detailPopup.open('bottom');
                        },
                        exchangeNumber: function () {
                            var that = this;
                            t.showLoading({
                                title: '加载中',
                                mask: true
                            });
                            this.startMoving = true;
                            setTimeout(function () {
                                that.startMoving = false;
                            }, 400);
                            setTimeout(function () {
                                that.$http('/boxes/'.concat(that.info.uuid, '/next-room'), 'GET', {
                                    uuid: that.info.uuid,
                                    current_room_id: that.room.id
                                })
                                    .then(function (e) {
                                        t.hideLoading();
                                        that.info.room = e.data.room;
                                    })
                                    .catch(function (n) {
                                        console.log(n);
                                        t.hideLoading();
                                    });
                            }, 200);
                        },
                        colorRgb: function (t) {
                            var n = t.toLowerCase();
                            if (4 === n.length) {
                                for (e = '#', i = 1, void 0; i < 4; i += 1) {
                                    var e;
                                    var i;
                                    e += n.slice(i, i + 1).concat(n.slice(i, i + 1));
                                }
                                n = e;
                            }
                            var o = [];
                            for (i = 1; i < 7; i += 2) {
                                o.push(parseInt('0x' + n.slice(i, i + 2)));
                            }
                            return this.sumArr(o);
                        },
                        sumArr: function (t) {
                            return t.reduce(function (t, n) {
                                return t + n;
                            }, 0);
                        }
                    }
                };
                n.default = c;
            }.call(this, e('543d').default));
        }
    },
    [['7f10', 'common/runtime', 'common/vendor']]
]);
</script>
<style>
@import './index.css';
</style>
